package com.hu.uitl;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;

public class MyJsoup {

    /**
     * 爬取彼岸壁纸
     */
    static void getbian(){
        Document doc = null;
        try {
            doc = Jsoup.connect("http://www.netbian.com/meinv/").get();//获取html的title document.title()
        } catch (IOException e) {
            e.printStackTrace();
        }
        Element l = doc.getElementById("main");
        Elements a= l.children();
        for (Element link : a)
        {
            Elements links = link.select("img");
            for (Element linki : links){
                System.out.println("src : " + linki.attr("src"));
                System.out.println("alt : " + linki.attr("alt"));
            }

        }
    }

    public static void main(String[] args){
        getbian();
    }

}
